<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block 标题 %} {% endblock %}</title>
    <link rel="stylesheet" href="{{ 构造url('静态', 文件名='css/bootstrap.css') }}">
    {% block 头部 %} {% endblock %}
</head>
<body>
    <div class="container">
        <nav class="navbar navbar-expand-lg navbar-light bg-light">
            <div class="container-fluid">
              <a class="navbar-brand" href="#">草蟒问答</a>
              <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
              </button>
              <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                  <li class="nav-item">
                    <a class="nav-link active" aria-current="page" href="{{ 构造url('问答.索引') }}">首页</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" href="{{ 构造url('问答.发布') }}">发布问答</a>
                  </li>
                </ul>
                  <form class="d-flex p-2" role="search" method="get" action="{{ 构造url('问答.搜索') }}">
                    <input class="form-control me-2" type="search" placeholder="关键词" name="搜索">
                    <button class="btn btn-outline-success" type="submit">
                        <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-search-heart" viewBox="0 0 16 16">
                            <path d="M6.5 4.482c1.664-1.673 5.825 1.254 0 5.018-5.825-3.764-1.664-6.69 0-5.018Z"/>
                            <path d="M13 6.5a6.471 6.471 0 0 1-1.258 3.844c.04.03.078.062.115.098l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1.007 1.007 0 0 1-.1-.115h.002A6.5 6.5 0 1 1 13 6.5ZM6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11Z"/>
                        </svg>
                    </button>
                  </form>
                {% if 用户 %}
                <ul class="d-flex navbar-nav">
                    <li class="nav-item">
                      <a class="nav-link" href="#">{{ 用户.用户名 }}</a>
                    </li>
                    <li class="nav-item">
                      <a class="nav-link" href="{{ 构造url('用户.退出') }}">退出</a>
                    </li>
                </ul>
                {% else %}
                <ul class="d-flex navbar-nav">
                    <li class="nav-item">
                      <a class="nav-link" href="{{ 构造url('用户.登录') }}">登录</a>
                    </li>
                    <li class="nav-item">
                      <a class="nav-link" href="{{ 构造url('用户.注册') }}">注册</a>
                    </li>
                </ul>
                {% endif %}
              </div>
            </div>
        </nav>
    </div>
    <div class="container mt-3">
      {% block 主体 %} {% endblock %}
    </div>
</body>
</html>